import {request} from "../../util/api";

export default {
	data() {
		return {
			carousels: [],
			evaluationIntroduction: {},
			news: [],
			videoIntroduction: {},
			current_new: {},
			videoClass: [],
			activity: []
		}
	},

	onShow() {
		this.getInfo()
	},

	methods: {
		getInfo() {
			request({
				url: '/app/index/info',
				token: true
			}).then(ret => {
				let {carousels, evaluationIntroduction, news,videoIntroduction,videoClass,activity} = ret.data
				this.carousels = carousels.filter(item => item.rotationType == '首页' || !item.rotationType);
				this.evaluationIntroduction = evaluationIntroduction;
				this.news = news.filter(item => item.newsType == '首页')
				this.videoIntroduction = videoIntroduction;
				this.videoClass = videoClass
				this.activity = activity
			})
		},
		jump(path, type) {
			if (type) {
				this.$u.route({
					url: path,
					type
				})
			} else {
				this.$u.route({
					url: path
				})
			}
		}
	}
}
